<template>
  <div class="child">
    child
    <button @click="handleClick">获取父组件中的数据和函数</button>
  </div>
</template>
<script>
export default {
  data() {
    return {
      son: '子组件中的数据'
    }
  },
  methods: {
    show() {
      console.log('子组件中定义的函数')
    },
    handleClick() {
      console.log(this.$parent.msg)
      this.$parent.fn()
      console.log(this.$root)
    }
  }
}
</script>
<style lang="scss" scoped></style>
